using System;

namespace micsun.Logic {
	
	public class ParameterNotFoundException : msException {
		const string MsgNo = "msLogic.ParamNotFound";
		
		public ParameterNotFoundException(string parameterName) : base(string.Format("Parameter not found!",parameterName)) {
			_paramName = parameterName;
		}

		string _paramName;

		public override string MessageNo {
			get {
				return MsgNo;
			}
		}

		public override string FormatMessage(string message) {
			return string.Format(message,_paramName);
		}

	}

	public class PrimaryKeyNotFoundException : msException {
		const string MsgNo = "msLogic.PKNotFound";

		public PrimaryKeyNotFoundException(string tableName) 
            : base("Table '"+tableName+"' has no primary key.") {
			_tableName = tableName;
		}

		string _tableName;

		public override string MessageNo {
			get {
				return MsgNo;
			}
		}

		public override string FormatMessage(string message) {
			return string.Format(message,_tableName);
		}
	}

	public class ParamNeedValueException :msException {
		public ParamNeedValueException(string parameterName )
			: base("Parameter '"+parameterName+"' need value.") {
			_paramName = parameterName;
		}

		string _paramName;
		const string MsgNo = "msLogic.ParamNeedValue";

		public override string MessageNo {
			get {
				return MsgNo;
			}
		}

		public override string FormatMessage(string message) {
			return string.Format(message,_paramName);
		}
	}
}
